<?php

namespace App;

use App\Model;

class Topic extends Model
{
    public function posts()
    {
        return $this->belongsToMany(\App\Post::class,
            'post_topics', 'topic_id', 'post_id');
    }

    public function  topicPosts(){
        return $this->hasMany('App\PostTopic','post_id','id');
    }
}
